﻿namespace Nasty.Core.LoadParams
{
    public class ResultData<T>
    {
        public bool IsSuccess { get; set; }

        public T? Data { get; set; }

        public string? Message { get; set; }
    }

    public class ResultHelper<T>
    {
        public static ResultData<T> Error(string msg)
        {
            var result = new ResultData<T>
            {
                IsSuccess = false,
                Message = msg,
                Data = default
            };

            return result;
        }

        public static ResultData<T> Success(T data, string msg = "")
        {
            var result = new ResultData<T>
            {
                IsSuccess = true,
                Data = data,
                Message = msg
            };
            return result;
        }
    }
}
